<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script>
         var money = 1000;
          var count = 0;
          //定义一个计数器
         while(money < 5000){
            money *= 1.05;
            //更新表达式
            count++;
         }

          console.log("一共需要"+count+"年");
        
    </script>
</head>
<body>
    
</body>
</html>